//
//  WealthyView.m
//  aiteshangcheng
//
//  Created by caominglei on 2018/4/24.
//  Copyright © 2018年 aite. All rights reserved.
//

#import "WealthyView.h"
#import "NoHighlightButton.h"
#import "UIImage+Category.h"
@interface WealthyView ()

@end
@implementation WealthyView
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createSubviews];
    }
    return self;
}
        
- (void)createSubviews

{
    NSArray *titleArray = @[@"创建时间",@"收入(元)",@"支出(元)",@"冻结(元)",@"变更说明"];
    for (int i = 0; i < titleArray.count; i++) {
        NoHighlightButton *selectedBtn = [NoHighlightButton buttonWithType:UIButtonTypeCustom];
        CGFloat margin = 1;
        CGFloat btnW = (kScreenWidth- 3*margin)/titleArray.count;
        CGFloat btnX = i * (btnW + margin);
        selectedBtn.frame = rect(btnX, 0, btnW, 40);
        selectedBtn.tag = 1420+i;
        selectedBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        [selectedBtn setTitle:titleArray[i] forState:UIControlStateNormal];
        [selectedBtn setBackgroundImage:[UIImage createImageWithColor:[UIColor groupTableViewBackgroundColor]] forState:UIControlStateNormal];
        [selectedBtn setBackgroundImage:[UIImage createImageWithColor:[UIColor whiteColor]] forState:UIControlStateSelected];
        [selectedBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];        //        selectedBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        selectedBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:selectedBtn];
        [selectedBtn addTarget:self action:@selector(wealthyBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
    }
}

- (void)wealthyBtnClicked:(UIButton *)button
{
    
}
@end
